<div class="container-fluid">
    <div class="wrapper">
        <div class="panel" id="nav">
            <div class="panel-heading"><h3 class="panel-title">入库明细报表</h3></div>
            <div class="panel-body">
                <form action="__URL__/StockIn_Detail" method="get">
                    <div class="container-fluid">
                        <div class="col-sm-12 col-md-3  add-space">
                            <div class="input-group input-group-md">
                                <span class="input-group-addon">所属公司主体</span>
                                <select name="enterprise_dominant" class="form-control">
                                    <option value="">全部</option>
                                    <volist name="enterprise_dominant" id="item">
                                        <option value="{$key}">{$item}</option>
                                    </volist>
                                </select>

                            </div>
                        </div>
                        <div class="col-sm-12 col-md-3  add-space">
                            <div class="input-group input-group-md">
                                <span class="input-group-addon">是否是出口退税</span>

                                <select name="export_tax_rebate" class="form-control">
                                    <option value="">全部</option>
                                    <volist name="export_tax_rebate" id="item">
                                        <option value="{$key}">{$item}</option>
                                    </volist>
                                </select>
                            </div>
                        </div>
                        <div class="col-sm-12 col-md-3  add-space">
                            <div class="input-group input-group-md">
                                <span class="input-group-addon">中转仓</span>

                                <select name="transfer_hopper_id" class="form-control">
                                    <option value="">全部</option>
                                    <volist name="transfer_hopper_id" id="item">
                                        <option value="{$key}">{$item}</option>
                                    </volist>
                                </select>
                            </div>
                        </div>
                        <div class="col-sm-12 col-md-3  add-space">
                            <div class="input-group input-group-md">
                                <span class="input-group-addon">运输方式</span>

                                <select name="transfer_type" class="form-control">
                                    <option value="">全部</option>
                                    <volist name="transfer_type" id="item">
                                        <option value="{$key}">{$item}</option>
                                    </volist>
                                </select>
                            </div>
                        </div>
                        <div class="col-sm-12 col-md-3  add-space">
                            <div class="input-group input-group-md">
                                <span class="input-group-addon">采购单</span>
                                <input type="text" name="purchaseorders_id" class="form-control" value="">
                            </div>
                        </div>
                        <div class="col-sm-12 col-md-3  add-space">
                            <div class="input-group input-group-md">
                                <span class="input-group-addon">SKU</span>
                                <input type="text" name="sku" class="form-control" value="">
                            </div>
                        </div>
                        <div class="col-sm-12 col-md-3  add-space">
                            <div class="input-group input-group-md">
                                <span class="input-group-addon">供应商</span>
                                <input type="text" name="supplier_id" class="form-control" value="">
                            </div>
                        </div>

                        <div class="col-sm-12 col-md-3  add-space">
                            <div class="input-group input-group-md">
                                <span class="input-group-addon">操作员</span>
                                <input type="text" name="warehouse_man" class="form-control" value="">
                            </div>
                        </div>
                        <div class="col-sm-12 col-md-3  add-space">
                            <div class="input-group input-group-md">
                                <span class="input-group-addon">批次号</span>
                                <input type="text" name="batch_code" class="form-control" value="">
                            </div>
                        </div>
                        <div class="col-sm-12 col-md-3  add-space">
                            <div class="input-group input-group-md">
                                <span class="input-group-addon">储位号</span>
                                <input type="text" name="storage_position" class="form-control" value="">
                            </div>
                        </div>
                        <div class="col-sm-12 col-md-3  add-space">
                            <div class="input-group input-group-md">
                                <span class="input-group-addon">入库类型</span>
                                <select name="type" class="form-control">
                                    <option value="">全部</option>
                                    <volist name="stock_in_type" id="item">
                                        <option value="{$key}">{$item}</option>
                                    </volist>
                                </select>
                            </div>
                        </div>
                        <div class="col-sm-12 col-md-3  add-space">
                            <div class="input-group input-group-md">
                                <span class="input-group-addon">自定义页数</span>

                                <select name="page" class="form-control">
                                    <option value="">选择（默认15）</option>
                                    <option value="15">15</option>
                                    <option value="30">30</option>
                                    <option value="50">50</option>
                                </select>
                            </div>
                        </div>
                        <!--<div class="col-sm-12 col-md-3  add-space">
                            <div class="input-group input-group-md">
                                <span class="input-group-addon">排序条件</span>

                                <select class="form-control" name="groupby">
                                    <option value="">选择（默认入库时间）</option>
                                    <option value='groupbysku'>SKU</option>
                                    <option value='groupbysupplier_id'>供应商</option>
                                    <option value='groupbyop_time'>入库日期</option>
                                </select>
                            </div>
                        </div>-->
                        <div class="col-sm-12 col-md-3  add-space">
                            <div class="input-group input-group-md">
                                <span class="input-group-addon">排序方式</span>

                                <select class="form-control" name="orderby">
                                    <option value="">选择（默认入库时间）</option>
                                    <option value='desc'>降序</option>
                                    <option value='asc'>升序</option>

                                </select>
                            </div>
                        </div>
                        <div class="col-sm-12 col-md-5  add-space">
                            <div class="input-group input-group-md">
                                <span class="input-group-addon">入库日期</span>
                                <input class="form-control form-date" type="text" name="op_time_from"
                                       style="cursor:pointer;" readonly>
                                <span class="input-group-addon"><span class="icon-calendar"></span></span>
                                <input class="form-control form-date" type="text" name="op_time_to"
                                       style="cursor:pointer;" readonly>

                            </div>
                        </div>


                        <div class="col-md-4 add-space">
                            <input class="btn btn-primary" type="submit" value="查询">
                            <input class="btn btn-primary" type="reset" value="重置">

                            <input class="btn btn-success" type="button" id="down" value="下载">
                        </div>


                    </div>
                </form>
                <div class="clearfix"></div>
                <hr>

                <table class="table table-striped  table-hover" cellspacing="0" width="100%">
                    <thead>
                    <tr>
                        <th>入库单号</th>
                        <th>站点</th>
                        <th>批次号</th>
                        <th>SKU</th>
                        <th>中文名称</th>
                        <th>是否出口退税</th>
                        <th>公司主体</th>
                        <th>中转仓</th>
                        <th>运输方式</th>
                        <th>入库时间</th>
                        <th>储位</th>
                        <th>入库量</th>
                        <th>可使用量</th>
                        <th>入库类型</th>
                        <th>成本</th>
                        <th>供应商</th>
                        <th>采购单号</th>
                        <th>单价</th>
                        <th>金额</th>
                        <th>入库人</th>
                        <th>备注</th>
                    </tr>

                    </thead>
                    <tbody id="table_content">
                    <?php foreach($data as $_data):?>
                    <tr>
                        <td><?php echo $_data['id']?></td>
                        <td><?php echo $_data['site_id']?></td>
                        <td><?php echo $_data['batch_code']?></td>
                        <td><?php echo $_data['sku']?></td>
                        <td><?php echo $_data['sku_name']?></td>
                        <td><?php echo $_data['export_tax_rebate']?></td>
                        <td><?php echo $_data['enterprise_dominant']?></td>
                        <td><?php echo $_data['transfer_hopper_id']?></td>
                        <td><?php echo $_data['transfer_type']?></td>
                        <td><?php echo $_data['op_time']?></td>
                        <td><?php echo $_data['storage_position']?></td>
                        <td><?php echo $_data['warehouse_quantity']?></td>
                        <td><?php echo $_data['available_quantity']?></td>
                        <td><?php echo $_data['type']?></td>
                        <td><?php echo $_data['cost']?> </td>
                        <td><?php echo $_data['supplier_id']?></td>
                        <td><?php echo $_data['purchaseorders_id']?></td>
                        <td><?php echo $_data['single_price']?></td>
                        <td><?php echo $_data['money']?></td>
                        <td><?php echo $_data['warehouse_man']?></td>
                        <td><?php echo $_data['remark']?></td>
                    </tr>
                    <?php endforeach;?>
                    <!--<tr>
                        <td colspan="17" class="text-center">
                            {$page}
                        </td>
                    </tr>-->
                    </tbody>
                </table>


                <div class="clearfix clear"></div>
                <div class="commonBtnArea">
                    <div class="page page-wrapper" style="text-align: center">
                        {$page}
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
    $(function () {
        $("input[name=sku]").val("<?php echo $_GET['sku']?>");
        $("input[name=batch_code]").val("<?php echo $_GET['batch_code']?>");
        $("input[name=op_time_from]").val("<?php echo $_GET['op_time_from']?>");
        $("input[name=op_time_to]").val("<?php echo $_GET['op_time_to']?>");
        $("input[name=purchaseorders_id]").val("<?php echo $_GET['purchaseorders_id']?>");
        $("input[name=supplier_id]").val("<?php echo $_GET['supplierid']?>");
        $("input[name=storage_position]").val("<?php echo $_GET['storage_position']?>");
        $("select[name=enterprise_dominant]").val("<?php echo $_GET['enterprise_dominant']?>");
        $("select[name=export_tax_rebate]").val("<?php echo $_GET['export_tax_rebate']?>");
        $("select[name=transfer_hopper_id]").val("<?php echo $_GET['transfer_hopper_id']?>");
        $("select[name=transfer_type]").val("<?php echo $_GET['transfer_type']?>");
        $("select[name=type]").val("<?php echo $_GET['type']?>");
    })
    $("#down").click(function () {
        var sku = $("input[name='sku']").val();
        var purchaseorders_id = $("input[name='purchaseorders_id']").val();
        var supplier_id = $("input[name='supplier_id']").val();
        var warehouse_man = $("input[name='warehouse_man']").val();
        var batch_code = $("input[name='batch_code']").val();
        var storage_position = $("input[name='storage_position']").val();
        var op_time_from = $("input[name='op_time_from']").val();
        var op_time_to = $("input[name='op_time_to']").val();
        var enterprise_dominant = $("select[name='enterprise_dominant']").val();
        var export_tax_rebate = $("select[name='export_tax_rebate']").val();
        var transfer_hopper_id = $("select[name='transfer_hopper_id']").val();
        var transfer_type = $("select[name='transfer_type']").val();
        var type = $("select[name='type']").val();
        var uri = 'sku=' + sku + '&purchaseorders_id=' + purchaseorders_id + '&supplier_id=' + supplier_id +
                '&warehouse_man=' + warehouse_man + '&batch_code=' + batch_code + '&storage_position=' +
                storage_position + '&op_time_from=' + op_time_from + '&op_time_to=' + op_time_to +
                '&enterprise_dominant=' + enterprise_dominant + '&export_tax_rebate=' + export_tax_rebate +
                '&transfer_hopper_id=' + transfer_hopper_id + '&transfer_type=' + transfer_type + '&type=' + type;
        window.location.href = "Warehouse/StockIn/Down_StockIn_Detail?" + uri;
    });
</script>



